{% load paging_extras %}
{% load sentry_helpers %}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta name="robots" content="NONE,NOARCHIVE">
        <link href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz:light,regular&amp;subset=latin" rel="stylesheet" type="text/css">
        <link href="{% url 'sentry-media' "styles/global.css" %}" rel="stylesheet" type="text/css"/>
        <link href="{% url 'sentry-media' "images/sentry.png" %}" rel="shortcut icon"/>
        <title>{% block title %}Sentry{% endblock %}</title>
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" src="{% url 'sentry-media' "scripts/highcharts.js" %}" ></script>
        <script type="text/javascript" src="{% url 'sentry-media' "scripts/jquery.animate-colors-min.js" %}"></script>
        <script type="text/javascript" src="{% url 'sentry-media' "scripts/global.js" %}"></script>
        <script type="text/javascript">
        Sentry.config({
            mediaUrl: '{% url 'sentry-media' '' %}',
            apiUrl: '{% url 'sentry-ajax' %}',
            defaultImage: '{% url 'sentry-media' 'images/sentry.png' %}'
        });
        {% if has_realtime %}
        Sentry.realtime.enable();
        {% endif %}
        </script>
    </head>

    <body>
        {% block body %}
        <div id="header">
            <div class="container">
                <h1><a href="{% url 'sentry' %}"><img src="{% url 'sentry-media' "images/sentry.png" %}" border="0" width="32"/>Sentry</a></h1>
                <h2>{% block heading %}Dashboard{% endblock %}</h2>
                <ul class="nav" id="account">
                    {% if request.user.is_authenticated %}
                        <li><a href="{% url 'sentry-logout' %}">Logout</a>
                    {% endif %}
                </ul>
            </div>
        </div>
        <div id="content">
            {% block content_before %}
            {% endblock %}
            <div class="container">
                {% block content %}
                    <div id="sidebar" class="column">
                        {% if chart_url %}
                            <h2>Last 24 Hours</h2>
                            <img src="{{ chart_url }}" class="chart" alt="chart"/>
                        {% endif %}

                        {% for filter in filters %}
                            <div class="sidebar-module sidebar-module-{{ filter.column }}">
                                {% if filter.show_label %}
                                    <h2>{{ filter.label }}</h2>
                                {% endif %}
                                <form method="get" action="{{ filter.get_query_string|safe }}">
                                    {{ filter.render }}
                                </form>
                            </div>
                        {% endfor %}
                    </div>

                    <div id="body" class="with-sidebar column">
                        {% paginate message_list from request as message_list per_page 15 %}

                        <div class="paging-wrap">
                            <div class="clearfix">
                                <form method="GET" action="">
                                    {% for k, v in request.GET.iteritems %}
                                        <input type="hidden" name="{{ k }}" value="{{ v }}"/>
                                    {% endfor %}
                                    <div class="sort-by">Sort by <select name="sort" onchange="this.form.submit()">
                                        <option value=""{% ifequal sort 'priority' %} selected="selected"{% endifequal %}>Priority</option>
                                        <option value="date"{% ifequal sort 'date' %} selected="selected"{% endifequal %}>Last Seen</option>
                                        <option value="new"{% ifequal sort 'new' %} selected="selected"{% endifequal %}>First Seen</option>
                                    </select>
                                    </div>
                                </form>
                                {% if has_realtime %}
                                    <a id="sentry_realtime" class="realtime realtime-pause">Pause Feed</a>
                                {% endif %}
                                {{ message_list.paging }}
                            </div>
                        </div>

                        {% if message_list.objects %}
                            <ul class="messages" id="message_list">
                                {% for group, priority in message_list.objects|with_priority %}
                                    {% include "sentry/partial/_group.html" %}
                                {% endfor %}
                            </ul>
                        {% else %}
                            <ul class="messages" id="message_list">
                                <li class="no-messages" id="no_messages">No messages match your filters.</li>
                            </ul>
                        {% endif %}

                        <div class="clearfix">
                            {{ message_list.paging }}
                        </div>

                    </div>
                {% endblock %}
            </div>
         </div>
        <div id="footer">
            <div class="container">
                Sentry {% sentry_version %} | Powered by sexy Django magic | Conjured up by the <a href="//code.disqus.com">DISQUS</a> team and other noble <a href="https://github.com/dcramer/django-sentry/contributors">sorcerers</a>.
            </div>
        </div>
        {% endblock %}
    </body>
</html>
